package com.ynny.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class UserDaoImpl implements UserDao {

    @Autowired
    JdbcTemplate jdbcTemplate;

    @Override
    public int updateUserBalance(Integer userId, Integer money) {

        String sql = "update t_user set balance = balance - ? where user_id = ?";

        return jdbcTemplate.update(sql, money, userId);
    }
}
